package edu.sctu.alex.June.day20150607;

import java.util.Scanner;

/**
 * Created by user03 on 2015/6/7.
 */
public class TimeMeter implements Runnable{

    Scanner scanner = new Scanner(System.in);
    int s=10000;
    @Override
    public void run() {
        System.out.println("请输入“开始”，开始计时");
        String str = scanner.next();
        if(str.equals("开始")){
            for (int i =1; i <s+1 ; i++) {
                System.out.println("已经过去："+i+"秒");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }

            }

        }else {

            System.out.println("输入不正确！");
        }


    }

    public static void main(String[] args) {
        TimeMeter timeMeter =new TimeMeter();
        Thread thread = new Thread(timeMeter);
        thread.start();




    }
}
